package com.cxx.purchasecharge.core.model.persistence;

import java.util.Date;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.Table;

import com.cxx.purchasecharge.core.model.BaseModel;

/**
 * 库存
 */
@Entity
@Table (name = "pc_goods_storage")
public class GoodsStorage extends BaseModel
{
    private static final long serialVersionUID = 1L;

    private long id;
    private Goods goods;

    /**
     * 初始库存
     */
    private long initialStock;
    /**
     * 当前库存
     */
    private long currentStock;
    /**
     * 最低库存
     */
    private long minStock;
    /**
     * 最高库存
     */
    private long maxStock;

    private Date createDate;
    private Date lastUpdated;
    private long userCreatedBy;
    private long userUpdatedBy;
    private String comment;
    
    public GoodsStorage () {}

    @Id
    @GeneratedValue (strategy = GenerationType.AUTO)
    public long getId ()
    {
        return id;
    }

    public void setId (long id)
    {
        this.id = id;
    }

    @OneToOne (cascade =
    { CascadeType.PERSIST, CascadeType.MERGE, CascadeType.REFRESH })
    @JoinColumn (unique = true, name = "goods_id")
    public Goods getGoods ()
    {
        return goods;
    }

    public void setGoods (Goods goods)
    {
        this.goods = goods;
    }

    @Column (nullable = false)
    public long getInitialStock ()
    {
        return initialStock;
    }

    public void setInitialStock (long initialStock)
    {
        this.initialStock = initialStock;
    }

    @Column (nullable = false)
    public long getCurrentStock ()
    {
        return currentStock;
    }

    public void setCurrentStock (long currentStock)
    {
        this.currentStock = currentStock;
    }

    @Column (nullable = false)
    public long getMinStock ()
    {
        return minStock;
    }

    public void setMinStock (long minStock)
    {
        this.minStock = minStock;
    }

    @Column (nullable = false)
    public long getMaxStock ()
    {
        return maxStock;
    }

    public void setMaxStock (long maxStock)
    {
        this.maxStock = maxStock;
    }

    @Column (nullable = false)
    public Date getLastUpdated ()
    {
        return lastUpdated;
    }

    public void setLastUpdated (Date lastUpdated)
    {
        this.lastUpdated = lastUpdated;
    }

    @Column (nullable = false)
    public Date getCreateDate ()
    {
        return createDate;
    }

    public void setCreateDate (Date createDate)
    {
        this.createDate = createDate;
    }

    @Column (nullable = false)
    public long getUserCreatedBy()
    {
        return userCreatedBy;
    }

    public void setUserCreatedBy(long userCreatedBy)
    {
        this.userCreatedBy = userCreatedBy;
    }

    @Column (nullable = false)
    public long getUserUpdatedBy()
    {
        return userUpdatedBy;
    }

    public void setUserUpdatedBy(long userUpdatedBy)
    {
        this.userUpdatedBy = userUpdatedBy;
    }

    @Column (length = 1024)
    public String getComment ()
    {
        return comment;
    }

    public void setComment (String comment)
    {
        this.comment = comment;
    }

}
